<!--
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-06-15 14:58:11
 * @LastEditTime: 2025-07-02 07:24:05
 * @LastEditors: Leequik
-->

<template>
    <div class="father">
        <h3>父组件</h3>
        <h4>汽车：{{ car }}</h4>
        <h5 v-show="toy">儿子给的玩具：{{toy}}</h5>
        
        <Child :car="car" :sendToy="getToy"/>
    </div>
</template>
<script lang="js" setup>
    import Child from './Child.vue';
    import {ref} from 'vue';
    
    //数据
    let car = ref('奔驰');
    let toy = ref('');
    
    //接收子组件传递的数据
    function getToy(value){
        toy.value = value;
        console.log(value);
    }

</script>

<style scoped>
    .father{
        background-color: pink;
        padding: 20px;
        border-radius: 10px;
    }
</style>